- var positives = proposal.upvotes || []
- var negatives = proposal.downvotes || []
- var neutrals = proposal.abstentions || []
- var census = neutrals.concat(negatives).concat(positives) || []

- var participants = proposal.participants || []

- var closed = proposal.closingAt && +new Date(proposal.closingAt) < Date.now()
- var voted = user && ~census.indexOf(user.id)

.inner-container.commentable-container

  .proposal-options
    .vote-box
      div#voting-error.alert.alert-warning.hide #{t('proposal-options.error.voting')}.
      - if (canVote)
        .meta-data(class= !!user.id ? '' : 'hide')
          - if(~positives.indexOf(user.id))
            include vote-positive
          - else if (~negatives.indexOf(user.id))
            include vote-negative
          - else if (~neutrals.indexOf(user.id))
            include vote-neutral

          a.meta-item.change-vote(href="#", class= voted && !closed ? '' : 'hide')
            i.icon-refresh
            small #{t('proposal-options.change-vote')}.

        .vote-options(class= voted || closed ? 'hide' : '')
          h5= t('proposal-options.vote')
          .direct-vote
            a.vote-option.vote-yes(href="#", data-proposal=proposal.id)
              i.flaticon.solid.thumbs-up-1
              span= t('proposal-options.yea')
            a.vote-option.vote-abstain(href="#", data-proposal=proposal.id)
              i.flaticon.solid.pause
              span= t('proposal-options.abstain')
            a.vote-option.vote-no(href="#", data-proposal=proposal.id)
              i.flaticon.solid.thumbs-up-1
              span= t('proposal-options.nay')

        - if (!user.id)
          p.text-mute.overlay-vote.hide= t('proposal-options.must-be-signed-in') + '. '
            a(href="/signin")= t('signin.login')
            = ' ' + t('common.or') + ' '
            a(href="/signup?reference=" + reference)= t('signin.signup')
            = '.'

      .votes-cast
        em.text-muted= t('proposal-options.votes-cast', { num: census.length || "0" })

    - if (closed)
      .results-box.row.clearfix
        p.alert.alert-info(class=census.length ? 'hide' : ''): label= t('proposal-options.no-votes-cast')
        .results-chart(class= census.length ? '' : 'hide').col-sm-6
          canvas#results-chart(width="220", height="220")
        .results-summary(class= census.length ? '' : 'hide').col-sm-6
          - if (positives.length)
            .votes-afirmative.votes-results
              h5= t('proposal-options.yea')
              - var width = census.length ? (positives.length/census.length)*100 : 0;
              - var width = Math.round(width*100)/100
              - var s = 1 === positives.length ? '' : 's'
              span.percent #{width} %
              span.votes #{positives.length} #{t('proposal-options.vote-item') + s}

          - if (negatives.length)
            .votes-negative.votes-results
              h5= t('proposal-options.nay')
              - var width = census.length ? (negatives.length/census.length)*100 : 0;
              - var width = Math.round(width*100)/100
              - var s = 1 === negatives.length ? '' : 's'
                span.percent #{width} %
                span.votes #{negatives.length} #{t('proposal-options.vote-item') + s}

          - if (neutrals.length)
            .votes-neutral.votes-results
              h5= t('proposal-options.abstain')
              - var width = census.length ? (neutrals.length/census.length)*100 : 0;
              - var width = Math.round(width*100)/100
              - var s = 1 === neutrals.length ? '' : 's'
                span.percent #{width} %
                span.votes #{neutrals.length} #{t('proposal-options.vote-item') + s}